home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / message / subcls / menusel.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-06-13  |  3.0 KB  |  103 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Menu Tips Demo"
  4.    ClientHeight    =   1755
  5.    ClientLeft      =   2220
  6.    ClientTop       =   2805
  7.    ClientWidth     =   4365
  8.    Height          =   2445
  9.    Left            =   2160
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1755
  12.    ScaleWidth      =   4365
  13.    Top             =   2175
  14.    Width           =   4485
  15.    Begin MsgHook MsgHook 
  16.       Left            =   120
  17.       Top             =   120
  18.    End
  19.    Begin Label lblStatusBar 
  20.       BackColor       =   &H00C0C0C0&
  21.       BorderStyle     =   1  'Fixed Single
  22.       Caption         =   "lblStatusBar"
  23.       Height          =   255
  24.       Left            =   720
  25.       TabIndex        =   0
  26.       Top             =   120
  27.       Width           =   3495
  28.    End
  29.    Begin Menu mnuFile 
  30.       Caption         =   "&File"
  31.       Begin Menu mnuFileExit 
  32.          Caption         =   "E&xit"
  33.       End
  34.    End
  35.    Begin Menu mnuEdit 
  36.       Caption         =   "&Edit"
  37.       Begin Menu mnuArray 
  38.          Caption         =   "Cu&t"
  39.          Index           =   1
  40.          Shortcut        =   ^X
  41.       End
  42.       Begin Menu mnuArray 
  43.          Caption         =   "&Copy"
  44.          Index           =   2
  45.          Shortcut        =   ^C
  46.       End
  47.       Begin Menu mnuArray 
  48.          Caption         =   "&Paste"
  49.          Index           =   3
  50.          Shortcut        =   ^V
  51.       End
  52.       Begin Menu mnuArray 
  53.          Caption         =   "&Delete"
  54.          Index           =   4
  55.          Shortcut        =   {DEL}
  56.       End
  57.    End
  58. Option Explicit
  59. ' Windows constants
  60. Const WM_MENUSELECT = &H11F
  61. Dim DefaultText As String
  62. Sub Form_Load ()
  63.     ' Setup MsgHook
  64.     MsgHook.HwndHook = Me.hWnd
  65.     MsgHook.Message(WM_MENUSELECT) = True
  66.     DefaultText = "Ready"
  67.     lblStatusBar = DefaultText
  68. End Sub
  69. Sub Form_Resize ()
  70.     ' Size label to status bar area (for users who don't have VB pro edition)
  71.     lblStatusBar.Move 0, ScaleHeight - lblStatusBar.Height, ScaleWidth
  72. End Sub
  73. Sub mnuArray_Click (Index As Integer)
  74.     ' Display message for dummy commands
  75.     MsgBox "This command is not implemented"
  76. End Sub
  77. Sub mnuFileExit_Click ()
  78.     Unload Me
  79. End Sub
  80. Sub MsgHook_Message (msg As Integer, wParam As Integer, lParam As Long, result As Long)
  81.     Dim txtStatus As String
  82.     If msg = WM_MENUSELECT Then
  83.         Select Case wParam
  84.             Case 0
  85.                 txtStatus = DefaultText
  86.             Case 2
  87.                 txtStatus = "Exits this program"
  88.             Case 4
  89.                 txtStatus = "Cuts the selected items to the clipboard and deletes them"
  90.             Case 5
  91.                 txtStatus = "Copies the selected items to the clipboard"
  92.             Case 6
  93.                 txtStatus = "Pastes the contents of the clipboard to the current location"
  94.             Case 7
  95.                 txtStatus = "Deletes the selected items"
  96.             Case Else
  97.                 txtStatus = ""
  98.         End Select
  99.         lblStatusBar = txtStatus
  100.         result = 0
  101.     End If
  102. End Sub
  103.